﻿using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using System.Collections.Generic;
using Freedom.Framework.Mvc.Routes;

namespace Freedom.HelloWorld
{
    public class RouteProvider : IRouteProvider
    {
        #region Implementation of IRouteProvider

        /// <summary>
        /// obsolete, prefer other format for extension methods
        /// </summary>
        public IEnumerable<Route> GetRoutes()
        {
            return new[]
                {
                    new Route(
                        "HelloWorld/{controller}/{action}/{id}",
                        new RouteValueDictionary(new { Area = "Freedom.HelloWorld", controller = "Home", action = "Index", id = UrlParameter.Optional}),
                        new MvcRouteHandler())
                };
        }

        public void GetApiRoutes(HttpRouteCollection routes)
        {
        }

        public void GetRoutes(RouteCollection routes)
        {
             foreach (var routeDescriptor in GetRoutes())
                routes.Add(routeDescriptor);
        }

        #endregion
    }
}